import { request } from './request'
import qs from 'qs';
export function getHome(){
    return request({
        url:'menus',
        method:'get'
        // data:qs.stringify(loginForm)
        // data:{loginForm}
    })
}
// user用户请求
export function getUser(queryList){
    return request({
        url:'users',
        method:'get',
        params:queryList,
        
    })
}
// user参数
export function getUserState(userinfo){
    return request({
        url:`users/${userinfo.id}/state/${userinfo.mg_state}`,
        method:'put',
        
        
    })
}
// 添加user数据
export function getAddUser(addForm){
    return request({
        url:'users',
        method:'post',
        data:qs.stringify(addForm)
    })
}

// 根据id查询商品
export function getAddUserInfo(id){
    return request({
        url:'users/' + parseInt(id),
        method:'get',
        
    })
}
//  修改用户请求
export function getUserModify(editForm){
    return request({
        url:'users/' + parseInt(editForm.id),
        method:'put',
        data:{
            email:editForm.email,
            mobile:editForm.mobile
        },
    })
}
// 删除用户请求
export function getDeleteUser(id){
    return request({
        url:'users/'+parseInt(id) ,
        method:'delete',
        
    })
}

// 确定按钮分配角色 请求
export function getSeletedUser(userInfo,seletRoleId){
    return request({
        url:`users/${userInfo.id}/role`,
        method:'put',
        data:{
        rid:parseInt(seletRoleId) ,
        }
    })
}   